const router = require('express').Router();
const mongoose = require('mongoose');
const DictionaryModel = mongoose.models['Dictionary'];
const WeChatUserModel = mongoose.models['WeChatUser'];

router.get('/do', async function (req, res, next) {
    try{
        let weChatUser=await DictionaryModel.findOne({_id:req.query._id});
        if(!weChatUser){
            return res.data(null);
        }else{
            return res.data(await weChatUser[req.query.method](req.query));
        }
    }catch(e){
        next(e.message);
    }
});

router.get('/getUserUpdate', async function (req, res, next) {
    try{
        let weChatUser=await DictionaryModel.findOne({_id:req.query._id});
        if(!weChatUser){
            return res.data(null);
        }else{

        }
    }catch(e){
        next(e.message);
    }
});

module.exports = router;